<#import "/spring.ftl" as spring/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/jquery/jquery-ui-1.8.23.custom.css' />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/ztree/zTreeStyle.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/form/jquery.mrd.form.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/jquery/jquery-ui-timepicker-addon.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/validata/validationEngine.jquery.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/layout/layout-default-latest.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/jqgrid/ui.jqgrid.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/jw/jw.css'  />" media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/multiselect/jquery.multiselect.css'  />"
      media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/main.css'  />" media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/css/global.css'  />" media="screen"/>
<link rel="stylesheet" type="text/css"
      href="<@spring.url 'http://www.56cyt.com:17080/layer/skin/layer.css'/>"/>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/BrowserDetect.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jquery/jquery-1.8.0.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jquery/jquery-ui-1.8.23.custom.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jquery/i18n/jquery.ui.datepicker-zh-CN.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jquery/i18n/jquery-ui-timepicker-addon.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/ztree/jquery.ztree.all-3.4.min.js'  />"></script>
<script type="text/javascript" src="<@spring.url '/js/form/jquery.form.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/validata/jquery.validationEngine-zh_CN.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/validata/jquery.validationEngine.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/layout/jquery.layout-latest.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jqgrid/i18n/grid.locale-cn.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jqgrid/jquery.jqGrid.min.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/jw/jw.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url '/js/form/jquery.mrd.form.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/util.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/multiselect/jquery.multiselect.js'  />"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/global.js'  />"></script>
<script type="text/javascript" src="<@spring.url '/dropdown-data.js'/>"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/layer/layer.js'/>"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/js.cookie.js'/>"></script>
<script type="text/javascript"
        src="<@spring.url 'http://www.56cyt.com:17080/js/ajaxutil.js'/>"></script>
<script type="text/javascript">
    $.fn.gridMethods = function () {
        var $myGrid = this;
        return {
            getIds: function () {
                return $myGrid.jqGrid('getGridParam', 'selarrrow');
            },
            getId: function () {
                return $myGrid.jqGrid("getGridParam", "selrow")
            },
            getRow: function (id) {
                return $myGrid.jqGrid("getRowData", id);
            },
            getSelectRow: function () {
                return this.getRow(this.getId());
            },
            getSelectRows: function () {
                var idArr = this.getIds();
                var rowArr = [];
                if (idArr.length > 0) {
                    for (var i = 0; i < idArr.length; i++) {
                        var id = idArr[i];
                        rowArr.push(this.getRow(id));
                    }
                }
                return rowArr;
            },
            getAllRowData: function () {
                return $myGrid.jqGrid('getRowData');
            },
            reload: function () {
                $myGrid.trigger("reloadGrid");
            }
        };
    };
    $.download = function (url, method, filedir, filename) {
        jQuery('<form action="' + url + '" method="' + (method || 'post') + '">' +  // action请求路径及推送方法
               '<input type="text" name="filedir" value="' + filedir + '"/>' + // 文件路径
               '<input type="text" name="filename" value="' + filename + '"/>' + // 文件名称
               '</form>')
                .appendTo('body').submit().remove();
    };
    var op = {
        eq: '=',
        ne: '<>',
        lt: '<',
        le: '<=',
        gt: '>',
        ge: '>=',
        bw: ' LIKE ',
        bn: ' NOT LIKE ',
        in: ' IN ',
        ni: ' NOT IN ',
        ew: ' LIKE ',
        en: ' NOT LIKE ',
        cn: ' LIKE ',
        nc: ' NOT LIKE '
    }
    function assembleWhereCase(object) {
        var whereCase = "";
        var columnName = {};
        for (var i = 0; i < object.length; i++) {
            if (!columnName[object[i].name]) {
                columnName[object[i].name] = 1;
            } else {
                columnName[object[i].name] += 1;
            }
            var j = columnName[object[i].name] - 1;
            var columnValue = $("input[name = '" + object[i].name + "']")[j].value;
            if (!columnValue) {
                continue;
            } else {
                columnValue = columnValue.trim();
            }
            var symbol = op[object[i].op];
            if (!symbol) {
                symbol = ' LIKE ';
            }
            if (object[i].type == 'date') {
                columnValue = "to_date('" + columnValue + "','yyyy-mm-dd')";
                if ('<=' == symbol) {
                    columnValue += "+1"
                }
            } else if (symbol.indexOf('LIKE') > 0) {
                columnValue = "'%" + columnValue + "%'";
            } else if (symbol.indexOf('IN') > 0) {
                columnValue = "(" + columnValue + ")";
            } else {
                columnValue = "'" + columnValue + "'";
            }
            whereCase += " and " + object[i].name + symbol + columnValue;
        }
        return whereCase;
    }
</script>
<style>
    .ui-autocomplete {
        max-height: 198px;
        overflow-y: auto;
    }
</style>
